package com.example.smart.room.bean;

import androidx.annotation.NonNull;
import androidx.room.ColumnInfo;
import androidx.room.Entity;
import androidx.room.Ignore;
import androidx.room.PrimaryKey;

import com.example.smart.data.AnimalData;
import com.example.smart.room.constants.SqlConstant;

@Entity(tableName = SqlConstant.ANIMAL)
public class AnimalBean {

    @PrimaryKey(autoGenerate = true)
    @ColumnInfo(name = "id")
    private Long id;

    @ColumnInfo
    private int earNo;

    @ColumnInfo
    private String birthday;

    @ColumnInfo
    private String type;

    @ColumnInfo
    private String sex;

    @ColumnInfo
    private String weight;

    @ColumnInfo
    private String source;

    @ColumnInfo
    private String dnDay;

    @ColumnInfo
    private String sexCount;

    @ColumnInfo
    private String img;

    public AnimalBean(@NonNull Long id, int earNo, String birthday, String type, String sex, String weight, String source, String dnDay, String sexCount, String img) {
        this.id = id;
        this.earNo = earNo;
        this.birthday = birthday;
        this.type = type;
        this.sex = sex;
        this.weight = weight;
        this.source = source;
        this.dnDay = dnDay;
        this.sexCount = sexCount;
        this.img = img;
    }

    @Ignore
    public AnimalBean(int earNo, String birthday, String type, String sex, String weight, String source, String dnDay, String sexCount, String img) {
        this.earNo = earNo;
        this.birthday = birthday;
        this.type = type;
        this.sex = sex;
        this.weight = weight;
        this.source = source;
        this.dnDay = dnDay;
        this.sexCount = sexCount;
        if (img == null) this.img = "";
        else this.img = img;
    }

    @NonNull
    public Long getId() {
        return id;
    }

    public void setId(@NonNull Long id) {
        this.id = id;
    }

    public int getEarNo() {
        return earNo;
    }

    public void setEarNo(int earNo) {
        this.earNo = earNo;
    }

    public String getBirthday() {
        return birthday;
    }

    public void setBirthday(String birthday) {
        this.birthday = birthday;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public String getWeight() {
        return weight;
    }

    public void setWeight(String weight) {
        this.weight = weight;
    }

    public String getSource() {
        return source;
    }

    public void setSource(String source) {
        this.source = source;
    }

    public String getDnDay() {
        return dnDay;
    }

    public void setDnDay(String dnDay) {
        this.dnDay = dnDay;
    }

    public String getSexCount() {
        return sexCount;
    }

    public void setSexCount(String sexCount) {
        this.sexCount = sexCount;
    }

    public String getImg() {
        return img;
    }

    public void setImg(String img) {
        this.img = img;
    }

    @Override
    public String toString() {
        return "AnimalBean{" + "id=" + id + ", earNo=" + earNo + ", birthday='" + birthday + '\'' + ", type='" + type + '\'' + ", sex='" + sex + '\'' + ", weight='" + weight + '\'' + ", source='" + source + '\'' + ", dnDay='" + dnDay + '\'' + ", sexCount='" + sexCount + '\'' + ", img='" + img + '\'' + '}';
    }

    public AnimalData toAnimalData() {
        return new AnimalData(earNo + "", birthday, type, sex, weight, source, dnDay, sexCount, img);
    }

}